#!/bin/bash

# 拉取远程所有分支
git fetch --all

# 遍历远程所有分支并创建本地分支跟踪
for branch in $(git branch -r | grep -v '\->'); do
    git branch --track "${branch#origin/}" "$branch"
done

# 切换到每个本地分支并拉取最新代码
for branch in $(git branch | grep -v '*'); do
    git checkout $branch
    git pull
done  
